package com.sc.nft.service.impl;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.sc.nft.entity.ApplicationRequirement;
import com.sc.nft.entity.UserInfo;
import com.sc.nft.entity.vo.ApplicationRequirementFactoryVO;
import com.sc.nft.enums.ApplicationRequirementEnum;
import com.sc.nft.service.ApplicationRequirementFactoryService;
import com.sc.nft.service.UserPerformanceService;
import com.sc.nft.util.DecideUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Slf4j
@RequiredArgsConstructor
@Service
public class TeamSalesApplicationRequirementFactoryServiceImpl implements ApplicationRequirementFactoryService {

    private final UserPerformanceService userPerformanceService;

    @Override
    public ApplicationRequirementFactoryVO applicationRequirement(UserInfo userInfo, ApplicationRequirement applicationRequirement,Integer type) {
//        BigDecimal theTotalPerformanceOfTheUserTeam = userPerformanceService.getPerformanceNearDate(userInfo.getId(), 30,type.intValue()==2 );
//        ApplicationRequirementFactoryVO applicationRequirementFactoryVO = new ApplicationRequirementFactoryVO();
//        applicationRequirementFactoryVO.setKey(StrUtil.format("{}{}{}", applicationRequirement.getType().getDescription(), applicationRequirement.getJudgingCriteria(), applicationRequirement.valueConvert()));
//        applicationRequirementFactoryVO.setAskForValue(applicationRequirement.getValue());
//        applicationRequirementFactoryVO.setPracticalValue(Convert.toInt(theTotalPerformanceOfTheUserTeam));
//        // 根据compoundMode字段中的 > < >= <= = 五中 来判定是否满足条件
//        applicationRequirementFactoryVO.setSatisfy(DecideUtil.conditionalDecision(Convert.toInt(theTotalPerformanceOfTheUserTeam), applicationRequirement.getValue(), applicationRequirement.getJudgingCriteria()));
//        return applicationRequirementFactoryVO;
        return null;
    }

    @Override
    public Integer code() {
        return ApplicationRequirementEnum.TEAM_SALES.getCode();
    }

}
